/**
 * 
 */
package com.java.test.user.mapper;

import java.util.Calendar;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import com.java.test.user.dto.Message_3;

/**
 * @author Administrator
 *
 */
@Component
public class LogMessage3Mapper {
	@Autowired
	private JdbcTemplate jdbcTemplate;

	public List<Message_3> selectAll() {
		String sql = "select * from ?";
		Calendar cal = Calendar.getInstance();
		StringBuffer str = new StringBuffer();
		str.append("log_message3_");
		int year = cal.get(Calendar.YEAR);
		int month = cal.get(Calendar.MONTH) + 1;
		str.append(year + "_");
		str.append(month);
		String table = str.toString();
		sql = sql.replace("?", table);
		List<Message_3> list = jdbcTemplate.query(sql, new Message_3());
		return list;

	}

}
